import React from 'react';
import { render } from 'react-dom';
import Son from './Son.js';
export default function Fun(){
	const [count,setCount] = React.useState(0);
	const [user,setUser] = React.useState({name:"张三",sex:"男"});
	function changeCount(){
		setCount(c=>c++);
	}
	const changeUser = React.useCallback((newname)=>{
		user.name = newname;
		setUser({...user})
	})
	render(){
		return (
		   <div>{count} <button onClick={changeCount}>修改</button>
		      <Son userInfo={user} callback={changeUser}/>
		   </div>
		)
	}
}